package com.link.base.base.inventmanage.service;

import com.link.base.base.inventmanage.dao.mybatis.mapper.InventoryManagementMapper;
import com.link.base.base.inventmanage.model.InventoryManagement;
import com.link.core.basic.dao.mapper.BasicMapper;
import com.link.core.basic.service.BasicServiceImpl;
import com.link.core.basic.service.ServiceException;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;


/**
 * @author: Huanglj
 * created: 2018/4/17
 * comments: 产品库存信息
 */
@Service
public class InventoryManagementServiceImpl extends BasicServiceImpl<InventoryManagement> implements InventoryManagementService {

    @Resource
    private InventoryManagementMapper inventoryManagementMapper;

    @Override
    public BasicMapper<InventoryManagement> getBasicMapper() {
        return inventoryManagementMapper;
    }

    /**
     * @param inventoryManagement
     * @return
     * @throws Exception
     * @Comments 根据客户名称查询库存信息
     */
    @Override
    public List<InventoryManagement> queryByAccntId(InventoryManagement inventoryManagement) throws Exception {
        Long accntId = inventoryManagement.getHeadId();
        if (null == accntId) {
            throw new ServiceException("PUBLIC-026");
        }

        List<InventoryManagement> inventoryManagementMapperList =
                inventoryManagementMapper.queryByAccntId(inventoryManagement);

        return inventoryManagementMapperList;
    }
}
